// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

//请求包vue resource http请求
import VueResource from 'vue-resource'
Vue.use(VueResource);

//jq
import $ from 'jquery';

//axios
import axios from 'axios';
Vue.prototype.$ajax = axios;

//common.js
import common from './common'

//bootstrap
import 'bootstrap/js/modal.js'
import 'bootstrap/js/dropdown.js'
import 'bootstrap/js/tooltip.js'

//font-awesome
import 'font-awesome/css/font-awesome.css'

//summernote
import 'summernote'
import 'summernote/dist/lang/summernote-zh-CN.js'
import 'summernote/dist/summernote.css';

//api 李军主接口配置
import API from "./utils/api_config";
Vue.prototype.api = API;

//api2 贺工京东订单相关接口
import api2 from "./utils/api_config2";
Vue.prototype.api2 = api2;

//tools导入
import jhTools from "./utils/jhTools";
Vue.prototype.tools = jhTools;

//vue-beauty
import 'vue-beauty/package/style/vue-beauty.min.css'
import vueBeauty from 'vue-beauty'
Vue.use(vueBeauty)

//elementUI
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI);

// //城市选择器
// import distpicker from 'distpicker'
// import VDistpicker from 'v-distpicker';
// Vue.component('v-distpicker', VDistpicker);

//echart
// import echarts from "echarts";
// Vue.prototype.$echarts = echarts;

Vue.prototype.myDataId = '88088'

// Vue.http.interceptors.push(function (request, next) { //拦截器
//   request.credentials = false;
//   next((res) => {
//     //401 登陆过期跳转
//     // console.log(res);
//     if (res.body.code == 401) {
//       router.push("/login");
//     }
//   })
// })





Vue.config.productionTip = false


/* eslint-disable no-new */
var nVue = new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: {
    App
  }
})


/* 初始化函数 */
Date.prototype.format = function(fmt) { 
  var o = { 
     "M+" : this.getMonth()+1,                 //月份 
     "d+" : this.getDate(),                    //日 
     "h+" : this.getHours(),                   //小时 
     "m+" : this.getMinutes(),                 //分 
     "s+" : this.getSeconds(),                 //秒 
     "q+" : Math.floor((this.getMonth()+3)/3), //季度 
     "S"  : this.getMilliseconds()             //毫秒 
 }; 
 if(/(y+)/.test(fmt)) {
         fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
 }
  for(var k in o) {
     if(new RegExp("("+ k +")").test(fmt)){
          fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
      }
  }
  return fmt; 
  /* 
    var time1 = new Date().format("yyyy-MM-dd hh:mm:ss");
    console.log(time1);
  */
} 



export default nVue;
